Support external Bitcoin nodes in hashi-localnet CLI#365
Support external Bitcoin nodes in hashi-localnet CLI#3650xsiddharthks wants to merge 3 commits intomainfrom
Conversation
|
Wonder if it would be possible to support external Sui network (devnet / testnet) too? |
223c348 to
355d8e5
Compare
|
@Bridgerz I have created a test implementation ( #407 ) which patches this function right before publishing the contract artifacts. but tbh it doesn't feel good. Not sure if we should try to do it. |
56da15b to
11d4b50
Compare
|
also wrapped all synchronous calls from corepc with |
11d4b50 to
1fd688e
Compare
Add --bitcoin-network flag to `hashi-localnet start` to connect to external Bitcoin nodes (signet, testnet4) instead of spawning a local regtest instance.
Qualify the rustdoc link to fix `make doc` CI failure.
The corepc-client uses the client-sync feature, so all Bitcoin Core RPC calls are blocking HTTP requests. When called from async functions they block the tokio worker thread. - Wrap Client in Arc<Client> in BitcoinNodeHandle and ExternalBitcoinNode so it can be cloned into spawn_blocking closures - Convert send_to_address, generate_blocks, get_new_address, get_balance, get_block_count to async with spawn_blocking - Wrap RPC calls in cmd_deposit poll loops with spawn_blocking - Persist btc_wallet in LocalnetState so deposit uses the correct wallet on non-regtest networks - Add crate-level spawn_blocking helper (same pattern as mpc_except_signing.rs)
1fd688e to
6a287a8
Compare
| /// Trait for Bitcoin node connectivity used by the hashi network builder. | ||
| pub trait BitcoinNodeInfo { | ||
| fn rpc_url(&self) -> &str; | ||
| fn p2p_address(&self) -> String; | ||
| } | ||
|
|
||
| impl BitcoinNodeInfo for crate::BitcoinNodeHandle { | ||
| fn rpc_url(&self) -> &str { | ||
| self.rpc_url() | ||
| } | ||
| fn p2p_address(&self) -> String { | ||
| self.p2p_address() | ||
| } | ||
| } |
| dir: &Path, | ||
| sui: &SuiNetworkHandle, | ||
| bitcoin: &BitcoinNodeHandle, | ||
| bitcoin: &impl BitcoinNodeInfo, |
There was a problem hiding this comment.
would it maybe be better to just pass in the rpc and p2p values directly vs needing to go through a trait?
Extends the hashi-localnet CLI to support running against external Bitcoin nodes (signet, testnet4), instead of only spawning a local regtest instance.
Usage